package com.bckj.fastboot.auth.config;

import com.bckj.fastboot.security.service.FastUserDetailsProvider;
import com.bckj.fastboot.upms.api.dto.ClientAuthInfo;
import com.bckj.fastboot.upms.api.dto.UserAuthInfo;
import com.bckj.fastboot.upms.api.service.SysOauthClientDetailsRemoteService;
import com.bckj.fastboot.upms.api.service.SysUserRemoteService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * FastUserDetailsProviderImpl
 *
 * @author wfc
 **/
@Component
public class FastUserDetailsProviderImpl implements FastUserDetailsProvider {

    @Resource
    private SysOauthClientDetailsRemoteService sysOauthClientDetailsRemoteService;
    @Resource
    private SysUserRemoteService sysUserRemoteService;

    @Override
    public ClientAuthInfo getClientDetails(String clientId) {
        return sysOauthClientDetailsRemoteService.findByClientId(clientId);
    }

    @Override
    public UserAuthInfo getSysUserDetails(String username) {
        return sysUserRemoteService.findByUsername(username);
    }
}
